﻿package com.tudou.ad.components
{
    import com.tudou.skin.*;
    import flash.display.*;
    import flash.events.*;

    public class AdVideoFloatBox extends Sprite
    {
        protected var clickButton:InteractiveObject;
        protected var closeButton:InteractiveObject;
        public static const CLICK:String = "info click!";
        public static const CLOSE:String = "info close click!";

        public function AdVideoFloatBox()
        {
            clickButton = new GetMoreBTN();
            closeButton = new GetMoreCloseBTN();
            var _loc_1:Boolean = true;
            buttonMode = true;
            useHandCursor = _loc_1;
            addChild(clickButton);
            closeButton.x = clickButton.width;
            addChild(closeButton);
            clickButton.addEventListener(MouseEvent.CLICK, clickHlr);
            closeButton.addEventListener(MouseEvent.CLICK, closeHlr);
            return;
        }// end function

        private function closeHlr(event:MouseEvent) : void
        {
            dispatchEvent(new Event(CLOSE));
            return;
        }// end function

        private function clickHlr(event:MouseEvent) : void
        {
            dispatchEvent(new Event(CLICK));
            return;
        }// end function

        public function clear() : void
        {
            if (clickButton)
            {
                clickButton.removeEventListener(MouseEvent.CLICK, clickHlr);
            }
            if (closeButton)
            {
                closeButton.removeEventListener(MouseEvent.CLICK, closeHlr);
            }
            while (this.numChildren > 0)
            {
                
                this.removeChildAt(0);
            }
            clickButton = null;
            closeButton = null;
            return;
        }// end function

    }
}
